package views
{
	import inerface.IDownloadZipPanel;
	
	import main.ViewSubBase;
	
	import panel.downloadZipPanel.DownloadZipPanel;
	
	public class DownloadZipView extends ViewSubBase
	{
		private var _panel:IDownloadZipPanel;
		
		public function DownloadZipView()
		{
		}
		
		public override function show():void
		{
			render();
		}
		
		protected override function render():void
		{
			if(!_panel){
				_panel = new DownloadZipPanel;
				_panel.init(view.layout.stage,view.resourceLoader,view.lang,view.uri);
				
				_panel.onChooseCity = chooseThisCity;
			}
			
			setData();
			
			addView(_panel);
		}
		
		private function setData():void
		{
//			var list:Array = [{cityName:"威海",cityId:1,fileName:"shandong-weihai",scenicList:[{scenicName:"赤山",scenicId:1,fileName:"shandong-weihai-chishan"},{scenicName:"刘公岛",scenicId:1,fileName:"shandong-weihai-liugongdao"}]}]
			
			var list:Array = data.cityList.allList;
			_panel.changeData(list);
		}
		
		private function chooseThisCity(id:String):void
		{
			data.cityList.chooseCityId = id;
			
			view.guide.setCityInfo();
			
			view.mainPanel.show();
		}
		
		public override function clear():void
		{
			if(_panel){
				_panel.clear();
				_panel = null;
			}
		}
		
		public override function close():void
		{
			closeView(this);
		}
	}
}